#include <iostream>

using namespace std;
int main() {
    int n; //幻方的大小
    int area[200][200]; //存储幻方的行和列
    int x, y; //横坐标、纵坐标
    cin>>n;
    //将1放在第一行中间
    area[1][n/2+1]=1;
    //记录当前横坐标、纵坐标
    x=1;
    y=n/2+1;
    // 遍历K值
    for (int i = 2; i <= n * n; ++i) {
        // 记录上一个数的坐标
        int prev_x = x;
        int prev_y = y;
        // 更新当前坐标
        if (x == 1 && y != n) {
            x = n;
            y = y + 1;
        } else if (y == n && x != 1) {
            x = x - 1;
            y = 1;
        } else if (x == 1 && y == n) {
            x = x + 1;
        } else {
            if (area[x - 1][y + 1] == 0) {
                x = x - 1;
                y = y + 1;
            } else {
                x = x + 1;
            }
        }
        // 填充当前数
        area[x][y] = i;
    }

    // 遍历输出
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            cout << area[i][j] << (j < n ? " " : "");
        }
        cout << endl;
    }

    return 0;
}